<template>
  <div>
    <CategorySelector :disabled="isShow !== 1" />
    <SpuList
      v-if="isShow === 1"
      @setIsShow="isShow = $event"
      @getSpuList="getSpuList"
    />
    <SaveSpu
      v-if="isShow === 2"
      :current-spu="spuList"
      @setIsShow="isShow = $event"
    />
    <SaveSku v-if="isShow === 3" :spu="spuList" @setIsShow="isShow = $event" />
  </div>
</template>

<script>
import SaveSpu from './components/SaveSpu.vue'
import SpuList from './components/SpuList'
import SaveSku from './components/SaveSku'
export default {
  name: 'Spu',
  components: {
    SpuList,
    SaveSpu,
    SaveSku
  },
  data() {
    return {
      // 1-->SpuList
      // 2-->SaveSpu
      // 3-->SaveSku
      isShow: 1,
      spuList: {}
    }
  },
  methods: {
    getSpuList(spuList) {
      this.spuList = {
        ...spuList,
        // spu图片(因为spuList是请求回来的数据,下面这俩值为null,重新初始化一下)
        spuImageList: [],
        // 销售属性
        spuSaleAttrList: []
      }
    }
  }
}
</script>

<style></style>
